package com.gamejelly.proxy.server;

import lombok.Data;

import java.lang.reflect.Method;
import java.util.concurrent.CompletableFuture;

@Data
public class Invoker {

    Object bean;

    Method method;

    Class<?>[] paramTypes;

    Class<?> returnType;

    String sign;

    public Invoker(String itfName, Object bean, Method method) {
        this.bean = bean;
        this.method = method;
        this.paramTypes = method.getParameterTypes();
        this.returnType = method.getReturnType();
        sign = itfName + "." + method.getName();
    }


    public boolean isVoid() {
        return returnType.equals(Void.class);
    }

    public boolean isAsync() {
        return returnType.equals(CompletableFuture.class);
    }
}
